import com.sun.xml.internal.ws.model.wsdl.WSDLOutputImpl;

import java.util.*;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: AliceMana
 * Date: 2022-11-21
 * Time: 17:29
 */
public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        String s1 = in.nextLine();
        String s2 = in.nextLine();
        Set<Character> set = new HashSet<>();
        for (int i = 0; i < s2.length(); i++) {
            set.add(s2.charAt(i));
        }
        List<Character> list = new ArrayList<>();
        int sz = s1.length();
        for (int i = 0; i < sz; i++) {
            if (!set.contains(s1.charAt(i))) {
                list.add(s1.charAt(i));
            }
        }
        for (char ch:
             list) {
            System.out.print(ch);
        }
    }


    public static void main1(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int t = 3*n;
        Integer[] arr = new Integer[t];
        while (t-- != 0) {
            arr[t] = in.nextInt();
        }
        Arrays.sort(arr, new Comparator<Integer>() {
            @Override
            public int compare(Integer o1, Integer o2) {
                return o2.compareTo(o1);
            }
        });
        long ret = 0;
        int j = -1;
        for (int i = 0; i < n; i++) {
            ret += arr[j+=2];
        }
        System.out.println(ret);
    }
}
